package com.riggie.ops.controller;

import com.riggie.extension.constant.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/consumer")
public class ConsumerController {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("get")
    public String consumer(){
        Message message = rabbitTemplate.receive(Constants.QOS_QUEUE);
        System.out.println("获取消息：" + message);
        return "获取消息成功";
    }
}
